import { connect } from "react-redux";
import { Switch, Route } from 'react-router-dom';
import { Redirect } from 'react-router-dom';
import { Nav } from './../components/Nav/nav';
import { Foot } from './../components/Footer/foot';
import { Attention } from './../components/Attention/attention';
import { Recommend } from "../components/Recommend/recommend";


class BbsUI extends React.Component {
    constructor(props) {
        super(props)
    }
    componentDidMount() {
        this.props.init();
    }
    render() {
        let { navList, footList } = this.props;
        return (
            <div className="box">
                <header><Nav navList={navList} /></header>
                <main>
                    <Switch>
                        <Redirect from="/bbs" exact={true} to="/bbs/recommend" />
                        <Route path="/bbs/recommend" component={Recommend} />
                        <Route path="/bbs/attention" component={Attention} />
                    </Switch>
                </main>
                <footer><Foot footList={footList} /></footer>
            </div>
        )
    }
}
let mstp = state => {
    return {
        footList: state.home.footList,
        navList: state.bbs.navList,
    }
};
let mdtp = (dispatch) => {
    return {
        init() {
        }
    }
}
export let Bbs = connect(mstp, mdtp)(BbsUI)